$(function() {

    // Override default error message
    $.validator.messages.required = "";

    // Override generation of error label
    $("#contact_info").validate({
        rules: {
            name: "required",
            mobile: "required",
            email: {
                required: true,
                email: true
            },
            notice:"required"
        },
        submitHandler: function(form) {
           
            $('#contact_info #send').attr('disabled','disabled');
            var form = $("#contact_info");
            var form_data = form.serialize();

            $.ajax({
                url: form.attr('action'),
                dataType: 'json',
                type: "POST",
                data: form_data,
                success: function (data, textStatus, xhr) {

                    if(data.action){
                        alert(data.msg);
                    }else{
                        alert(data.msg);  
                        $('#contact_info #send').removeAttr('disabled');
                    }
                    

                },
                error: function (xhr, textStatus, errorThrown) {
                    alert('Error ocured...\n Server not found.');
                    $('#contact_info #send').removeAttr('disabled');

                }
            });

            return false;

        },
        errorPlacement: function(error, element){}


    });

    $('#contact_info #send').removeAttr('disabled');

});